#include<bits/stdc++.h>
using namespace std;
long long n,a[200050],sum[200050],maxx,hh,ll;
int main(){
	freopen("color.in","r",stdin);
	freopen("color.out","w",stdout);
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);	
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		if(a[i]!=a[i-1]){
			hh++;
		}	
		else {
			ll++;
		}
	}
	cout<<ll-1;
	return 0;
}
//1 2 2 3 3 
//1 2 2 4 5
//1 2 1 2 3
//1 1 2 4 4 7 7 9 10
//1 1 1 2 2
